<?php

namespace app\adminbackstage\model;

use think\Model;

class Order extends Model
{
    /***订单列表
     * @param $where array
     * @param $page int
     * @param $num int
     * @param $order string
     * @param $field string
     * @return json
     */
    public static function dataList($where,$page,$num,$field="*",$order="id desc"){
        return self::where($where)->field($field)->order($order)->page($page,$num)->select();
    }

    public static function dataCount($where){
        return self::where($where)->count();
    }


    /***订单信息
     * @param $where array
     * @return json
     */
    public static function dataView($where){
        return self::where($where)->find();
    }


    /*** 新增订单
     * @param $data
     * @return $id
     */
    public static function dataAdd($data){
        return self::create($data);
    }


    /*** 修改订单
     * @param $data
     * @return bool
     */
    public static function dataEdit($where,$data){
        return self::where($where)->update($data);
    }


}